{
  //声明一个接口
  interface Response<T> {
    status: number;
    headers: object;
    data: T;
  }

  interface Book {
    id: number;
    title: string;
    price: number;
  }

  interface Movie {
    id: number;
    name: string;
    director: string;
  }

  //声明一个对象
  let response: Response<Book> = {
    status: 200,
    headers: {
      a: 100,
    },
    data: {
      id: 1,
      title: "西游记",
      price: 19.9,
    },
  };

  //声明一个对象
  let response2: Response<Movie> = {
    status: 201,
    headers: {},
    data: {
      id: 2,
      name: "让子弹飞",
      director: "姜文",
    },
  };
}

{
  interface Book {
    id: number;
    title: string;
    price: number;
  }

  interface Movie {
    id: number;
    name: string;
    director: string;
  }

  interface ResponseBody<T> {
    code: string;
    msg: string;
    data: T;
  }

  interface Response<T> {
    status: number;
    headers: object;
    data: T;
  }

  //声明对象
  let response: Response<ResponseBody<Book>> = {
    status: 200,
    headers: {},
    data: {
      code: "0000",
      msg: "操作成功",
      data: {
        id: 1,
        title: "水浒传",
        price: 29.0,
      },
    },
  };

  //二次声明
  let response2: Response<ResponseBody<Movie>> = {
    status: 200,
    headers: {},
    data: {
      code: "0000",
      msg: "操作成功",
      data: {
        id: 5,
        name: "坚如磐石",
        director: "张艺谋",
      },
    },
  };
}
